<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
	
			<li class="active" id="list"><a href="{:url('Park/index')}">孵化器</a></li>
			<li><a href="{:url('Park/addPark')}">添加</a></li>
			<!-- 	<li><a href="{:url('user/add')}">{:lang('ADMIN_USER_ADD')}</a></li> -->
		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('Park/index')}">
		
			孵化器性质:
			<select class="form-control" name="incubator_type" style="width: 140px;">
				<option value='0'>全部</option>
				<option value="1">园区</option>
				<option value="2">众创</option>

			</select> &nbsp;&nbsp;



			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:url('Park/index')}">清空</a>
		</form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="2%">ID</th>
					<th width="1%">孵化器名称</th>
					<th width="13%">孵化器性质</th>
					<th width="10%">图片</th>
					<th width="15%">地址</th>
					<th width="5%">联系方式</th>
					<th width="9%">是否可用</th>
					<th width="13%">是否银江自有</th>
					<!-- <th>序列号</th> -->
					<th  width="23%"">简介</th>
					<th width="10%">操作</th>
				</tr>
			</thead>
			<tbody>
				<!-- 	<php>$user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));</php> -->
				
				<foreach name="list" item="vo" key="k">
					<tr>
					    <php>$img_url=cmf_get_image_preview_url($vo['pic_url']); </php>
					    <input type="hidden" name="id" value="">
						<td>{$k+1}</td>
						<td><a class="btn " href='{:url('Park/detailPark',array('id'=>$vo.id))}'>{$vo.incubator_name}</a></td>
						<td><if condition="$vo.incubator_type eq 1">园区 <else />空间</if></td>
						
						<td><!-- <div class="col-md-6 col-sm-10">
					<imagetpl name="img" id="img" value="$img_url"/>
				</div> -->
                       <div><a href="{$img_url}"><img src="{$img_url}" style="width:70px;display:block;"/></a></div>
				        </td>
						<td>{$vo.address}</td>
						<td>{$vo.tel}</td>
						<td><if condition="$vo.is_use eq 1">可用 <else />禁用</if></td>
						<td><if condition="$vo.park_type eq 1">是 <else />否</if></td>
						<!-- <td>{$vo.sort}</td> -->
						<td>{$vo.describe}</td>
						<td>
							<a class='edit' href='{:url('Park/editPark',array('id'=>$vo.id))}'>编辑</a>
							|
							<a class='del' id="{$vo.id}" <if condition="$vo.is_use eq 1">is_use="1" <else />is_use="2"</if>><if condition="$vo.is_use eq 1">禁用 <else />取消禁用</if></a>
							|
							<a class='delete' id="{$vo.id}" >删除</a>
						</td>


					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script>
	  $(".del").click(
		  function(){
			var text=$(this).attr('is_use');
			
			if(text==1){
				if(confirm("确认要禁用吗")){
					var id=$(this).attr("id");
					$.post("{:url('delPark')}",
						{id:id},
						function(data,status){
							alert(data);
							location.href="{:url('index')}";
						});
				}
			}	

			if(text==2){
				if(confirm("确认要取消禁用吗")){
					var id=$(this).attr("id");
					$.post("{:url('delPark')}",
						{id:id,cancel:1},
						function(data,status){
							alert(data);
							location.href="{:url('index')}";
						});
				}
			}	

		}
		)

	$(function(){
		type=<?php echo $incu_type; ?>;
		if(type){
			$("select[name=incubator_type]").find("option[value="+type+"]").attr("selected","selected");
		}	
	})
	




	$(".delete").click(
		function(){
		
			
		
				if(confirm("确认要删除吗")){
					var id=$(this).attr("id");
					$.post("{:url('delete')}",
						{id:id},
						function(data,status){
							alert('删除成功');
							location.href="{:url('index')}";
						});
				}
		

			// if(text==2){
			// 	if(confirm("确认要取消禁用吗")){
			// 		var id=$(this).attr("id");
			// 		$.post("{:url('delPark')}",
			// 			{id:id,cancel:1},
			// 			function(data,status){
			// 				alert(data);
			// 				location.href="{:url('index')}";
			// 			});
			// 	}
			// }	

		}
		)










</script>